<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <ui:composition template="../templates/TemplatePrincipal.xhtml">
        
        <ui:define name="top">
            
        </ui:define>
        <ui:define name="content">
            <h:panelGroup id="messagePanel" layout="block">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
            </h:panelGroup>
            <h:form enctype="multipart/form-data">
                <h:panelGrid columns="2">
                    
                    <h:outputLabel value="#{mensagens.CreateFilmeLabel_titulo}" for="titulo" />
                    <h:inputText id="titulo" value="#{filmeController.selected.titulo}" title="#{mensagens.CreateFilmeTitle_titulo}" />
                    <p:fileUpload sizeLimit="204800" widgetVar="uploader" multiple="false" label="Escolher arquivo" auto="true" fileUploadListener="#{filmeController.selected.capa}" allowTypes="*.jpg;*.png;*.gif;"/>
                    </h:inputText>
                    <h:outputLabel value="#{mensagens.CreateFilmeLabel_duracao}" for="duracao" />
                    <h:inputText id="duracao" value="#{filmeController.selected.duracao}" title="#{mensagens.CreateFilmeTitle_duracao}" />
                    <h:outputLabel value="#{mensagens.CreateFilmeLabel_descricao}" for="descricao" />
                    <h:inputTextarea rows="4" cols="30" id="descricao" value="#{filmeController.selected.descricao}" title="#{mensagens.CreateFilmeTitle_descricao}" />
                    <h:outputLabel value="#{mensagens.CreateFilmeLabel_preco}" for="preco" />
                    <h:inputText id="preco" value="#{filmeController.selected.preco}" title="#{mensagens.CreateFilmeTitle_preco}" required="true" requiredMessage="#{mensagens.CreateFilmeRequiredMessage_preco}"/>
                    <h:outputLabel value="#{mensagens.CreateFilmeLabel_midiaIdMidia}" for="midiaIdMidia" />
                    <h:selectOneMenu id="midiaIdMidia" value="#{filmeController.selected.midiaIdMidia}" title="#{mensagens.CreateFilmeTitle_midiaIdMidia}" required="true" requiredMessage="#{mensagens.CreateFilmeRequiredMessage_midiaIdMidia}">
                        <f:selectItems value="#{midiaController.itemsAvailableSelectOne}"/>
                    </h:selectOneMenu>
                    <h:outputLabel value="#{mensagens.CreateFilmeLabel_categoriaIdCategoria}" for="categoriaIdCategoria" />
                    <h:selectOneMenu id="categoriaIdCategoria" value="#{filmeController.selected.categoriaIdCategoria}" title="#{mensagens.CreateFilmeTitle_categoriaIdCategoria}" required="true" requiredMessage="#{mensagens.CreateFilmeRequiredMessage_categoriaIdCategoria}">
                        <f:selectItems value="#{categoriaController.itemsAvailableSelectOne}"/>
                    </h:selectOneMenu>
                </h:panelGrid>
                <br />
                <h:commandLink action="#{filmeController.create}" value="#{mensagens.CreateFilmeSaveLink}" />
                <br />
                <br />
                <h:commandLink action="#{filmeController.prepareList}" value="#{mensagens.CreateFilmeShowAllLink}" immediate="true"/>
                <br />
                <br />
                <h:link outcome="/index" value="#{mensagens.CreateFilmeIndexLink}"/>
            </h:form>
        </ui:define>
        <ui:define name="bottom">
            
        </ui:define>
    </ui:composition>

</html>
